import * as constants from './constants'
import api from '../../../api/api'
import Immutable from 'immutable';


const changeCourse = (result) => ({
	type: constants.CHANGE_COURSE,
	value: Immutable.fromJS(result)
})


export const getCourseList = (params) => (dispatch) => {
  api.findLesson(params).then(res => {
    if(res.code === 20000) {
      dispatch(changeCourse(res.data))
    }
  })
}


export const getCourseListByPhone = (params) => (dispatch) => {
  api.findPhoneLesson(params).then(res => {
    if(res.code === 20000) {
      dispatch(changeCourse(res.data))
    }
  })
}

